from django.db import models

# Create your models here.

# 导入时间域
from django.utils import timezone

# 基类
class Base(models.Model):

    # 创建时间
    crerta_time = models.DateTimeField(default=timezone.now,null=True)

    class Meta:
        abstract = True


# 用户表
class MdUser(Base):
    username = models.CharField(max_length=200)
    password = models.CharField(max_length=200)

    class Meta:
        db_table = 'mduser'

# 产品表
# class Good(Base):
#     title = models.CharField(max_length=200)
#     price = models.IntegerField()
#     img = models.FileField(null=True)
#     class Meta:
#         db_table = 'good'

# 订单表
class GoodsInfo(Base):
    title = models.CharField(max_length=200)
    price = models.IntegerField()
    count = models.IntegerField()
    img = models.FileField(null=True)
    username = models.CharField(max_length=200)
    class Meta:
        db_table = 'goodsinfo'


# 详单详情表
class Comment(Base):
    title = models.CharField(max_length=200)
    img = models.FileField(null=True)
    price = models.IntegerField()
    username = models.CharField(max_length=200)
    content = models.CharField(max_length=200)
    class Meta:
        db_table = 'comment'


# 商品表
class Goods(models.Model):
    title = models.CharField(max_length=20)
    price = models.IntegerField()
    # 图片
    img = models.FileField(null=True)

    class Meta:
        db_table = 'goods'

# 用户表
class User(models.Model):
    username = models.CharField(max_length=200)
    password = models.CharField(max_length=200)
    # 类别 0为普通用户 1为会员
    type = models.IntegerField(default=0,null=True)
    class Meta:
        db_table = 'user'



# 购物车表
class Orders(models.Model):
    username = models.CharField(max_length=200)
    total = models.CharField(max_length=200,null=True)
    type = models.IntegerField(default=0,null=True)
    title = models.CharField(max_length=200)
    price = models.IntegerField(default=0)
    img = models.FileField(null=True)

    class Meta:
        db_table = "orders"

class Userss(models.Model):
    username = models.CharField(max_length=200)
    password = models.CharField(max_length=200)
    img = models.CharField(max_length=200)
    class Meta:
        db_table = 'userss'


# 考试













